<?php

namespace app\xf\model;

use think\Model;

class DataModel extends Model
{
    //
    protected $table = 'xf_data';


    public function getIdAttr($value)
    {
        return "000" . $value;
    }

    public function setLatlngAttr($value)
    {
        return json_encode($value);
    }

    public function getLatlngAttr($value)
    {
        return json_decode($value, true);
    }

    public function setConfigAttr($value)
    {
        return json_encode($value);
    }

    public function getConfigAttr($value)
    {
        return json_decode($value);
    }

    public function setStyleAttr($value)
    {
        return json_encode($value);
    }

    public function getStyleAttr($value)
    {
        return json_decode($value);
    }

    public function setQyidAttr($value)
    {
        return json_encode($value);
    }

    public function getQyidAttr($value)
    {
        return json_decode($value);
    }

//    public function getDidAttr($value)
//    {
//        return '000' . $value;
//    }

    public function file()
    {
        return $this->belongsTo('FileModel', 'fileid');
    }

    public function icon()
    {
        return $this->hasOne('IconModel', 'id', 'iconid');
    }
}
